const fs = require('fs');
let user = { username:"admin1",password:"12345" };
let str = fs.readFileSync('persons.json','utf-8');
let o = JSON.parse(str).findIndex(item => item.username === user.username);
if(o === -1){
    console.log('注册成功');
    str.push(user);
    fs.writeFileSync('persons.json',JSON.stringify(str));
}else{
    console.log('账号已被注册');
};



